(function () {
    "use strict";

    angular.module('core').factory('indiceMonetarioService', factory);
    factory.$inject = ['$http', '$q'];

    function factory($http, $q) {

        return {
            get: function (id) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/get', id)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            getAll: function (args) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/getall', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            count: function (args) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/count', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            getValorIndiceMonetario: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/indiceMonetario/getValorIndiceMonetario', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            getAllValorIndiceMonetario: function (args) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/getAllValorIndiceMonetario', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            countValorIndiceMonetario: function (args) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/countValorIndiceMonetario', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            prepareNew: function () {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/prepareNew')
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepare: function (item) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/prepare', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            prepareNewValorIndiceMonetario: function (item) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/prepareNewValorIndiceMonetario', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepareValorIndiceMonetario: function (item) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/prepareValorIndiceMonetario', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            save: function (item) {
                var deferred = $q.defer();
                $http.post('/indiceMonetario/save', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            delete: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/indiceMonetario/delete', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
        };
    }

})();


